﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using FutSA.Bussiness.Contexts ;
using FutSA.Data;

public partial class Controles_Time_Formulario : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    { 
        
    }
    protected void btnConfirmar_Click(object sender, EventArgs e)
    {
        Time objTime = new Time();
        FutSADataSet dsTime = objTime.DataSet;
        FutSADataSet.TimeRow timeRow = dsTime.Time.NewTimeRow();
 
        try
        {
            timeRow.Sigla = txtSigla.Text;
            timeRow.Nome = txtNome.Text;
            timeRow.Apelido = txtApelido.Text;
            timeRow.DataFundacao = Convert.ToDateTime(txtDataFundacao.Text);
            timeRow.Endereco = "";
            timeRow.SiteOficial = "";
            timeRow.EstadioID = 0;
            timeRow.TimeMascoteID = 0;
            timeRow.TimeEmblemaID = 0;

            TimeEmblema timeEmblema = new TimeEmblema();
            FutSADataSet dataSet = timeEmblema.DataSet;
            FutSADataSet.TimeEmblemaRow timeEmblemaRow = dataSet.TimeEmblema.NewTimeEmblemaRow();
            timeEmblemaRow.Nome = txtNome.Text;
            timeEmblemaRow.ImagemUrl = "http://www.uol.com.br";
            dataSet.TimeEmblema.AddTimeEmblemaRow(timeEmblemaRow);
            timeEmblema.Update(dataSet);
        }
        catch (Exception)
        {
            throw;
        }
    }
}
